#include <stdio.h>
#include <string.h>

strip(char string[]) {
    /*
     *	Python equivalent of strip(), I guess? 
     *
     *	Biggest issue was returning the array; 
     *	instead of doing that, it modifies the 
     *	original array.
    */
    char *m, *n; 
    m = string; 
    // Dropped the null zero since otherwise, 
    // the "while" loop below doesn't work as nicely
    n = m + strlen(string) - 1; 
    
    // If using direct comparison, other space 
    // characters (like "\t") go unchecked;
    // this way we loop _after_ verifying isspace()
    while ( isspace(*m) ) m++;
    while ( isspace(*n) ) n--;

    char *s, store[n - m + 1];
    s = store; 
    while (m <= n) *(s++) = *(m++); 
    *s = '\0'; 

    strcpy(string, store); 
}

main() {
    char wordlist[] = "   This is a list of wordS \t"; 
    printf("Before (%d): \"%s\"\n", sizeof(wordlist), wordlist);
    
    strip(wordlist);
    printf("After (%d): \"%s\"\n", sizeof(wordlist), wordlist);
}
